﻿@model IEnumerable<ActionTrackerEntities.Usuario>
@{
    ViewBag.Title = "Usuarios | ActionTracker";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section script
{
    <script src="@Url.Content("~/Scripts/jquery.dataTables.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/TableTools.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/dataTables.editor.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/dataTables.bootstrap.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/dataTables.editor.bootstrap.js")" type="text/javascript"></script>
    
    <link href="@Url.Content("~/Content/themes/dataTables.bootstrap.css")" rel="stylesheet" type="text/css" />
    
    <script type="text/javascript">

        $(document).ready(function () {
            $('#tbl').dataTable({
                "sDom": 'T<"clear">lfrtip',
                "oTableTools": {
                    "aButtons": []
                },
                "bLengthChange": false,
                "bFilter": true,
                "bSort": true,
                "bInfo": false,
                "oLanguage": {
                    "sProcessing": "Procesando datos...",
                    "sSearch": "Buscar:",
                    "sInfo": "",
                    "sInfoEmpty": " ",
                    "sInfoFiltered": "(filtr&eacute; de _MAX_ &eacute;l&eacute;ments au total)",
                    "sInfoPostFix": "",
                    "sLoadingRecords": "Cargando datos...",
                    "sZeroRecords": "No se encontraron usuarios",
                    "sEmptyTable": "No hay usuarios para mostrar",
                    "oPaginate": {
                        "sFirst": "Primera",
                        "sPrevious": "Anterior",
                        "sNext": "Siguiente",
                        "sLast": "Última"
                    }
                }

            });
        });
    </script>
}
<legend>Usuarios</legend>
<p>
    @Html.ActionLink("Nuevo Usuario", "Create")
</p>
@if (Session["MensajeExito"] != null)
{
    <div class="alert alert-success" data-dismiss="alert">
        <strong>@Session["MensajeExito"].ToString()</strong> 
    </div>
         
    Session["MensajeExito"] = null;
}

@if (Session["MensajeError"] != null)
{
    <div class="alert alert-error" data-dismiss="alert">
        <strong>@Session["MensajeError"].ToString()</strong> 
    </div>
         
    Session["MensajeError"] = null;
}


<table id="tbl" class="table table-striped table-bordered">
    <thead>
        <tr>
            <th>
                #
            </th>
            <th>
                Nombre
            </th>
            <th>
                Tipo de usuario
            </th>
            <th>
                Fecha baja
            </th>
            <th>
                
            </th>
        </tr>
    </thead>
    <tbody>
      @foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.IdUsuario)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Nombre)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.StrTipoUsuario)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.StrFechaBaja)
            </td>
            <td>
                @Html.ActionLink("Editar", "Edit", new { id = item.IdUsuario }) 
                @*|
                @Html.ActionLink("Eliminar", "Delete", new { id = item.IdUsuario }) *@
                
            </td>
        </tr>
    }
    </tbody>
</table>
